{extend name="../../admin/view/main"}

{block name="content"}
<div class="layui-tab layui-tab-card">
    <ul class="layui-tab-title notselect">
        {php}$types = ['ta' => '全部订单', 't0' => '等待支付', 't4' => '等待发货', 't5' => '等待收货', 't6' => '已经完成', 't7' => '退货售后'];{/php}
        {foreach $types as $k=>$v}{if isset($type) and 't'.$type eq $k}
        <li class="layui-this" data-open="{:url('index')}?type={$k}">{$v}<sup class="layui-badge border-radius">{$total[$k]??0}</sup></li>
        {else}
        <li data-open="{:url('index')}?type={$k}">{$v}<sup class="layui-badge border-radius">{$total[$k]??0}</sup></li>
        {/if}{/foreach}
    </ul>
    <div class="layui-tab-content">
        {include file='shop/order/index_search'}
        <table class="layui-table margin-top-10" lay-skin="line">
            {notempty name='list'}
            <thead>
            <tr>
                <th class='list-table-check-td think-checkbox'>
                    <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
                </th>
                <th>用户信息</th>
                <th>推荐/来源信息</th>
                <th>订单信息</th>
                <th>发货信息</th>
                <th>其他信息</th>
                <th>商品信息</th>
            </tr>
            </thead>
            {/notempty}
            <tbody>
            {foreach $list as $key=>$vo}
            <tr>
                <td class='list-table-check-td think-checkbox'>
                    <label><input class="list-check-box" type='checkbox' value='{$vo.id}'></label>
                </td>
                <td class="nowrap relative">
                    <div>
                        <div class="headimg" data-lazy-src="{$vo.user.headimg|default='__ROOT__/static/theme/img/headimg.png'}" data-tips-image></div>
                        <div class="inline-block sub-strong-red">
                            用户昵称：<span class="color-text">{$vo.user.nickname|default='--'}</span><br>
                            用户手机：<span class="color-text">{$vo.user.phone|default='--'}</span><br>
                        </div>
                    </div>
                </td>
                <td class="nowrap relative">

                    <div>
                        <!--{notempty name='vo.from'}-->
                        <div class="headimg" data-lazy-src="{$vo.from.headimg|default='__ROOT__/static/theme/img/headimg.png'}" data-tips-image></div>
                        <div class="inline-block sub-strong-red">
                            <div>本单来源：<span class="color-text">{$vo.from.nickname|default='--'}</span></div>
                            <div>来源用户手机：<span class="color-text">{$vo.from.phone|default='--'}</span></div>
                        </div>
                        <!--{else}-->
                        <div class="color-desc padding-10">没有来源</div>
                        <!--{/notempty}-->
                    </div>
                    <div>
                        <!--{notempty name='vo.parent'}-->
                        <div class="headimg" data-lazy-src="{$vo.parent.headimg|default='__ROOT__/static/theme/img/headimg.png'}" data-tips-image></div>
                        <div class="inline-block sub-strong-red">
                            <div>直接推荐人：<span class="color-text">{$vo.parent.nickname|default='--'}</span></div>
                            <div>推荐人手机：<span class="color-text">{$vo.parent.phone|default='--'}</span></div>
                        </div>
                        <!--{else}-->
                        <div class="color-desc padding-10">没有推荐人</div>
                        <!--{/notempty}-->
                    </div>
                </td>
                <td class='nowrap'>
                    {eq name='vo.status' value='0'}<span class="layui-badge layui-badge-middle layui-bg-gray layui-border-cyan" data-tips-text="{$vo.cancel_remark}">已经取消</span>{/eq}
                    {eq name='vo.status' value='1'}<span class="layui-badge layui-badge-middle layui-bg-red">预购订单</span>{/eq}
                    {eq name='vo.status' value='2'}<span class="layui-badge layui-badge-middle layui-bg-red">等待待付款</span>{/eq}
                    {eq name='vo.status' value='3'}<span class="layui-badge layui-badge-middle layui-bg-orange">等待审核</span>{/eq}
                    {eq name='vo.status' value='4'}<span class="layui-badge layui-badge-middle layui-bg-black">等待发货</span>{/eq}
                    {eq name='vo.status' value='5'}<span class="layui-badge layui-badge-middle layui-bg-blue">已经发货</span>{/eq}
                    {eq name='vo.status' value='6'}<span class="layui-badge layui-badge-middle layui-bg-green">已经完成</span>{/eq}
                    {eq name='vo.status' value='7'}<span class="layui-badge layui-badge-middle layui-bg-red">退货售后</span>{/eq}
                    <div class="inline-block text-middle">
                        <div class="sub-strong-blue">
                            订单单号：<b>{$vo.order_no|default=''}</b>
                        </div>
                        <div class="sub-strong-blue">
                            商品总价：<b>{$vo.amount_total+0}</b> 元
                            <span class="color-green">{if $vo.amount_express>0}(含运费 {$vo.amount_express+0} 元{else}(包邮{/if})</span>
                            实际支付 <b>{$vo.payment_amount+0}</b> 元
                        </div>
                        <div>下单时间：<span class="color-text">{$vo.create_at|format_datetime}</span></div>
                        <!--{notempty name='vo.payment_status'}-->
                        <div>
                            支付时间：<span class="color-text">{$vo.payment_datetime|format_datetime}</span>
                        </div>
                        <!--{else}-->
                        支付状态：<span class="color-desc">还未支付</span>
                        <!--{/notempty}-->
                        <!--{notempty name='vo.order_remark'}-->
                        订单备注：<span class="color-desc">{$vo.order_remark}</span>
                        <!--{/notempty}-->
                        {if isset($type) and $type eq 7}
                            <div>
                                审核状态：
                                {if $vo.back_status eq 2}
                                    <span class="color-red">已驳回</span>
                                    <a class="margin-left-5" data-modal="{:url('shop.order/rebackdetail')}?order_no={$vo.order_no}" data-title="查看">查看</a>
                                {elseif $vo.back_status eq 1/}
                                    <span class="color-green">已通过</span>
                                    <a class="margin-left-5" data-modal="{:url('shop.order/rebackdetail')}?order_no={$vo.order_no}" data-title="查看">查看</a>
                                {elseif $vo.back_status eq 3/}
                                    <span class="color-text">已取消</span>
                                    <a class="margin-left-5" data-modal="{:url('shop.order/rebackdetail')}?order_no={$vo.order_no}" data-title="查看">查看</a>
                                {else/}
                                    <span class="color-text">审核中</span>
                                    <a class="margin-left-5" data-modal="{:url('shop.order/rebackaudit')}?order_no={$vo.order_no}" data-title="审核">审核</a>
                                {/if}
                            </div>
                            <div>申请时间：<span class="color-text">{$vo.reback_date|format_datetime}</span></div>
                            <div>审核时间：<span class="color-text">{$vo.reback_audit_date|format_datetime}</span></div>
                        {/if}
                    </div>
                </td>
                <td class="nowrap">
                    <div>收货信息：{$vo.username|default='--'}<span class="margin-left-5 color-blue">{$vo.phone|default=''}</span></div>
                    <div>收货地址：{$vo.address|default='--'}</div>
                    <div>发货状态：
                        {if $vo.truck_type eq 1}
                            {if $vo.status eq 4}
                                待发货
                            {elseif $vo.status eq 5 or $vo.status eq 6 or $vo.status eq 7/}
                                已发货
                                <b class="layui-badge layui-bg-orange">{$vo.trade_no|default='--'}</b>
                            {else/}
                                未支付
                            {/if}
                            <!--{if auth('upsendtruck') and $vo.status eq 4}-->
                            <a class="margin-left-5" data-modal="{:url('shop.order/sendMd')}?order_no={$vo.order_no}" data-title="面单发货">面单发货</a>
                            <a class="margin-left-5" data-modal="{:url('shop.order/handFill')}?order_no={$vo.order_no}" data-title="手动发货">手动发货</a>
                            <!--{elseif auth('upsendtruck') and $vo.status eq 5}-->
                            {if $vo.is_hand_fill eq 0}
                                {if $vo.is_download eq 1}
                                    <a class="margin-left-5" href="{:url('shop.order/downloadMd')}?order_no={$vo.order_no}" data-title="重新下载">重新下载</a>
                                {else/}
                                    <a class="margin-left-5" href="{:url('shop.order/downloadMd')}?order_no={$vo.order_no}" data-title="面单下载">面单下载</a>
                                {/if}
                                <a class="margin-left-5" data-modal="{:url('shop.order/cancelMd')}?order_no={$vo.order_no}" data-title="撤销面单">撤销面单</a>
                            {/if}
                            <a class="margin-left-5" data-modal="{:url('shop.order/orderTrace')}?order_no={$vo.order_no}" data-title="物流跟踪">物流跟踪</a>
                            <!--{/if}-->
                        {else/}
                            无需发货
                        {/if}

                        <!--{if auth('cancel') and in_array($vo.status, [1,2,3])}-->
                        <a class="margin-left-5" data-confirm="确认要取消订单吗？" data-load="{:url('cancel')}?order_no={$vo.order_no}">取消订单</a>
                        <!--{/if}-->
                    </div>
                    <div>发货时间：{$vo.trade_send_time|default='--'}</div>
                </td>
                <td class="nowrap">
                    <div>发票：
                        {if $vo.getbill eq 1}
                        需要【{if $vo.have_bill eq 1}<span class="color-green">已开票</span>{else/}<span class="color-red">未开票</span>{/if}】
                        <a class="margin-left-5" data-modal="{:url('shop.order/checkbill')}?order_no={$vo.order_no}" data-title="查看">查看</a>
                        {else/}
                        不需要
                        {/if}
                    </div>
                </td>
                <td class="nowrap">
                    {foreach $vo.items as $g}
                    <div class="margin-bottom-10" style="width:400px;text-overflow: ellipsis;overflow:hidden;white-space:nowrap;">
                        <img src="{$g.goods_cover}" width="50" data-tips-hover data-tips-image data-lazy-src="{$g.goods_cover}">
                        <b class="color-blue">{$g.stock_sales|default=0}件</b><span class="color-red"> x </span><b class="color-blue">{$g.price_selling+0}元 </b>
                        {$g.goods_name|default=''} <span class="color-green"> ( {$g.goods_spec|default=''} )</span>
                    </div>
                    {/foreach}
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
    </div>
</div>
{/block}
